image: ruby:alpine
variables:
  JEKYLL_ENV: "$SEARCH_AND_DEPLOY_ENV"
stages:
  - test
  - deploy
before_script:
  - apk add --update build-base libffi-dev libcurl nodejs-current
  - bundle install --jobs $(nproc) --deployment
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - vendor/bundle
test:
  stage: test
  script:
    - bundle exec rake
  only:
    - master
pages:
  stage: deploy
  script:
    - bundle exec rake publish
  artifacts:
    paths:
      - public
  only:
    - master
  allow_failure: true
